/*
	This file is part of PropExtractor.

	PropExtractor is free software: you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation, either version 3 of the License, or
	(at your option) any later version.

	PropExtractor is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with PropExtractor. If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef _PEALICESOFTIMAGEAJP_H_
#define _PEALICESOFTIMAGEAJP_H_

#include "PEFile.h"
#include "PEImage.h"

namespace pe
{

	struct AliceImageAjpHeader
	{
		byte header[4];
		dword version;
		dword header_size;
		dword width;
		dword height;
		dword data_offset;
		dword data_length;
		dword alpha_offset;
		dword alpha_length;
		byte unknown1[4];
		dword unknown2;
	};

	struct AliceImageAjp
	{
		AliceImageAjpHeader* header;

		unsigned int width, height;

		unsigned int data_size;
		byte* data;
	};

	PE_EXPORT int AliceImageAjpReadHeader(AliceImageAjpHeader* a_Target, PEStream* a_Stream);
	PE_EXPORT int AliceImageAjpReadData(AliceImageAjp* a_Target, AliceImageAjpHeader* a_Header, PEStream* a_Stream);
	PE_EXPORT int AliceImageAjpToRaw(PEImageRaw* a_Target, AliceImageAjp* a_Image);

	PE_EXPORT int AliceImageAjpReadAndDecrypt(PEImageRaw* a_Target, PEStream* a_Stream);

	PE_EXPORT int AliceImageAjpDeleteHeader(AliceImageAjpHeader* a_Header);
	PE_EXPORT int AliceImageAjpDeleteData(AliceImageAjp* a_Image);

	class PE_DLL_EXPORT ImageAliceSoftAjp : public PEImage
	{

	public:

		ImageAliceSoftAjp();
		~ImageAliceSoftAjp();

		int LoadHeader(PEStream* a_Stream);
		int LoadBody();

	protected:

		AliceImageAjpHeader m_Header;
		AliceImageAjp m_Body;

	}; // class ImageAliceSoftAjp

}; // namespace pe

#endif